@extends('shop::layouts.master')
@section('title')
    收益明细-检测机构
@endsection
@section('tab')
    <div class="layui-fluid">
        <div class="layui-row layui-col-space15">
            <div class="layui-col-md12">
                <div class="layui-card">
                    <div class="layui-card-body ">
                        <form class="layui-form layui-col-space5">
                            @switch($arr_search['date_type'])
                                @case('Ymd')
                                <button class="layui-btn layui-btn-normal" name="date_type" value="Ymd">日</button>
                                <button class="layui-btn layui-btn-primary" name="date_type" value="Ym">月</button>
                                <button class="layui-btn layui-btn-primary" name="date_type" value="Y">年</button>
                                @break

                                @case('Ym')
                                <button class="layui-btn layui-btn-primary" name="date_type" value="Ymd">日</button>
                                <button class="layui-btn layui-btn-normal" name="date_type" value="Ym">月</button>
                                <button class="layui-btn layui-btn-primary" name="date_type" value="Y">年</button>
                                @break

                                @case('Y')
                                <button class="layui-btn layui-btn-primary" name="date_type" value="Ymd">日</button>
                                <button class="layui-btn layui-btn-primary" name="date_type" value="Ym">月</button>
                                <button class="layui-btn layui-btn-normal" name="date_type" value="Y">年</button>
                                @break

                                @default
                                <button class="layui-btn layui-btn-normal" name="date_type" value="Ymd">日</button>
                                <button class="layui-btn layui-btn-primary" name="date_type" value="Ym">月</button>
                                <button class="layui-btn layui-btn-primary" name="date_type" value="Y">年</button>
                            @endswitch

                                <div class="layui-input-inline layui-show-xs-block">
                                    <input class="layui-input" placeholder="开始日" value="{{$arr_search['start']}}" lay-verify="required" name="start" id="start">
                                </div>
                                <div class="layui-input-inline layui-show-xs-block">
                                    <input class="layui-input" placeholder="截止日" value="{{$arr_search['end']}}" name="end" id="end">
                                </div>
                            <div class="layui-input-inline layui-show-xs-block">
                                <button class="layui-btn" lay-submit="" lay-filter="sreach">
                                    <i class="layui-icon">&#xe615;</i>
                                </button>
                                <button class="layui-btn" onclick="location.reload()">
                                    <i class="layui-icon layui-icon-refresh"></i>
                                </button>
                            </div>
                        </form>
                    </div>
{{--                    <div class="layui-card-body">--}}
{{--                        <button class="layui-btn" onclick="xadmin.open('添加','{{route('shop_master_create')}}')">--}}
{{--                            <i class="layui-icon"></i>添加--}}
{{--                        </button>--}}
{{--                    </div>--}}
                    <div class="layui-card-body layui_overflow_y ">
                        <table class="layui-table layui-form">
                            <thead>
                            <tr>
                                <th>日期</th>
                                <th>总收入</th>
                                <th>总退款</th>
                                <th>总收益</th>
                                <th>总数量</th>
                            </tr>
                            </thead>
                            <tbody>
                            @if(!empty($data))
                            @foreach($data as $key=>$value)
                                <tr>
                                    <td>{{$value['date']}}</td>
                                    <td>{{$value['pay_price']}}</td>
                                    <td>{{$value['refund_price']}}</td>
                                    <td>{{$value['profit']}}</td>
                                    <td>{{$value['num']}}</td>

                                </tr>
                            @endforeach
                            @else
                                <td colspan="66" align="center">暂无数据</td>
                            @endif
                            </tbody>
                        </table>
                    </div>

                </div>
            </div>
        </div>
    </div>

@endsection

@section('tab_js')
    <script>
        layui.use(['laydate'],
            function () {
                var laydate = layui.laydate;

                //执行一个laydate实例
                laydate.render({
                    elem: '#start' //指定元素
                    ,done: function(value){
                        var end = $('#end').val();
                        if (end && value > end) {
                            layer.msg('开始日必须小于截止日');
                            $('#start').val('');
                        }
                    }
                });

                //执行一个laydate实例
                laydate.render({
                    elem: '#end' //指定元素
                    ,done: function(value){
                        var start = $('#start').val();
                        if (start && value < start) {
                            layer.msg('截止日必须大于开始日');
                            $('#end').val('');
                        }
                    }
                });

            }
        );

    </script>
@endsection




